/**
 * 部门添加js
 */
var comValidform=null;
var returnStatus=false;
var departmentUpdate={
	dataCache:null,
		
	startEvent:function(){
		departmentUpdate.showInfo();
		
		comValidform=$(".com-addForm").Validform({
			tiptype:2,
			tipSweep:true,
			beforeSubmit:function(curform){
				var url = 'mgr/OrganizationCtrl/update';
				var params = jsUtils.serializeJson($('.com-addForm'));

				params.actUserId=userId;
				if(params.actUserId == ''){
					alert("登录超时，请重新登录后重试");
					return false;
				}

				var cb = function(data){
					alert(data.msg);
					//成功返回
					if(data.resultCode==200){
						//关闭窗口并刷新数据
						art.dialog.close();
						returnStatus=true;
					}
					$("#changeID").html(null);
					$("#changeName").html(null)
				};
				sendApiNoLoadSync(url, params, cb, 'POST');
				return false;
			}
		});
	},
	
	showInfo:function(){
		var id=art.dialog.data('id');  //修改id
		var name=art.dialog.data('name'); 
		$("#id").val(id);
		$("#name").val(name);
		
	},
	
	init:function(){
		departmentUpdate.startEvent();
	}
}
$(document).ready(function() {
	departmentUpdate.init();
});
function submitForm(){
	comValidform.submitForm();
	return returnStatus;
}